Targeting AutoCAD for DOS R13 with Watcom C/C++ 10.x
The following demonstrates how to create and debug an AutoCAD for Windows application with Watcom C/C++ version 10.x.
This example uses the TOWER program included with AutoCAD for DOS release 13.
1. Ensure the Environment is set up Properly
The Watcom and ADS environment variables should be set properly. In addition to the Watcom environment, the following should be defined for AutoCAD for Windows:
path=%path%;d:\acad
include=%include%;d:\acadr13\common\ads
set ACAD=d:\acadr13\common\support;d:\acadr13\dos;d:\acadr13\dos\support; d:\acadr13\common\fonts
set ACADCFG=d:\acadr13\dos
set ACADDRV=d:\acad\dos\drv
NOTE: With earlier versions of Watcom the "DOSX" environment variable was required to be set to "-priv". This should not be done with release 13.
2. Create the Application
Create the application as follows:
wcc386 winads -d2 -s -j -fpi87 -fpr -3s -opmaxet
wcc386 tower.c -d2 -s -j -fpi87 -fpr -3s -opmaxet
wlink @TOWER.LNK
Where TOWER.LNK consists of the following:
debug all
system ads
name tower
library wcads100.lib
file tower
option map
3. Setup the Debugger
If you are using 10.0 you will need to upgrade to the 'A' level patch in order to debug your application. You will require the ADSHELP.EXP contained in this zip file in order to debug AutoCad R13 for DOS applications.
Add the following to your ADSHELP.EXP file.
d:\watcom\bin\adshelp.exp
5. Running the Debugger
i) Start the Watcom Debugger as follows:
wd /trap=ads /swap
ii) When the debugger prompts you for a filename to debug, either press ESC or select CANCEL.
iii) Select "Command" from the File menu and enter in the following:
"ads c:\fullpath\tower.exp"
NOTE: It is recommeded that you enter in the full path to your application.
iv) AutoCAD will now start. Type (xload "c:/fullpath/foo.exp") at the AutoCAD command prompt.
NOTE: It is recommended that you specify the full pathname to tower.exp. Also note that the
path uses the '/' character instead of the '\' as DOS does. This is because AutoCAD
parses the single '\' out of the string.
v) You will now be in the debugger at the mainline of tower.exp. From here you can debug tower.exp.